--斧铳封锁
local futongfengshuo = fk.CreateSkill{
    name = "mcdh_futongfengshuo",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

futongfengshuo:addEffect(fk.HpChanged,{
    can_trigger =  function(self, event, target, player, data)
        return player:hasSkill(self) and player:getMark("mcdh_ammo") >=2
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        if room:askForSkillInvoke(player, self.name, nil, "#mcdh_futongfengshuo-invoke:"..target.id ) then
            lib.mcdh_ammo(player, -2)
            return true
        end
    end,
    on_use  = function(self, event, target, player, data)
        local room = player.room
        room:damage{
            from = player,
            to = target,
            damage = 1,
            skillName = self.name,
        }
        if data.reason == "recover" then
            room:setPlayerMark(target, "@@mcdh_futongfengshuo-turn", 1)
        end
    end
})

futongfengshuo:addEffect('prohibit',{
    prohibit_use = function(self, player, card)
        return player:getMark("@@mcdh_futongfengshuo-turn") ~= 0
    end,
    prohibit_response = function(self, player, card)
        return player:getMark("@@mcdh_futongfengshuo-turn") ~= 0
    end,
})

Fk:loadTranslationTable {
    ["mcdh_futongfengshuo"] = "兵封",
    [":mcdh_futongfengshuo"] = "『斧铳封锁』<br>装填技(2)，当一名角色的体力值变化后，你可以对其造成1点伤害，若该变化为回复体力，则额外令其不能使用或打出牌直到回合结束。",
    ["#mcdh_futongfengshuo-invoke"] = "斧铳封锁:对 %src 造成1点伤害",
    ["@@mcdh_futongfengshuo-turn"] ="斧铳封锁",
}

return futongfengshuo